package com.derbysoft.lowcostadapter.web.action.model;

import com.derbysoft.lowcostadapter.commons.exception.InputErrorException;
import com.derbysoft.lowcostadapter.commons.model.RoomType;
import com.derbysoft.lowcostadapter.commons.redis.utils.KeyValueHelper;
import org.apache.commons.lang.StringUtils;

/**
 * Created by: jason
 * Date: 2012-09-26
 */
public class RoomTypeCondition {
    private String roomTypeId;

    public String getRoomTypeId() {
        return roomTypeId;
    }

    public void setRoomTypeId(String roomTypeId) {
        this.roomTypeId = roomTypeId;
    }

    public String makeKey() {
        return RoomType.PREFIX + KeyValueHelper.SEPARATOR + getRoomTypeId();
    }

    public void validate() {
        if (StringUtils.isBlank(roomTypeId)) {
            throw new InputErrorException("Required fields can not be empty !");
        }
    }
}
